<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>-</title>
	<link rel="stylesheet" href='<c:url value="/resources/css/main.css"/>' type="text/css" />
	<link rel="stylesheet" type="text/css" href='<c:url value="/resources/easyui/themes/default/easyui.css"/>'/>
	<link rel="stylesheet" type="text/css" href='<c:url value="/resources/easyui/themes/icon.css"/>'/>
	<script type="text/javascript" src='<c:url value="/resources/easyui/jquery-1.4.4.min.js"/>'></script>
	<script type="text/javascript" src='<c:url value="/resources/easyui/jquery.easyui.min.js"/>'></script>
	<script type="text/javascript" src='<c:url value="/resources/editarea_0_8_2/edit_area/edit_area_full.js"/>'></script>
	<script type="text/javascript">
	$(function(){
	
		editAreaLoader.init({
			id: "xml",
			start_highlight: true,
			allow_resize: "both",
			allow_toggle: false,
			word_wrap: false,
			language: "zh",
			syntax: "xml"
		});

		$('#cancel').click(function() {
			$('#f')[0].reset();
		});
		
		$('#save').click(function() {
			$.ajax({
				url: "<c:url value='/admin/service/update/service'/>",
				type: "POST",
				dataType: "json",
				data: ({
					serviceName: $('#serviceName').val(),
					description: $('#description').val(),
					xml: $('#xml').val()
				}),
				success: function(msg) {
					if (msg.result === 'ok') {
						alert('服务设置已经保存');
					}
					else {
						alert('保存失败：\n' + msg.message);
					}
				}
			});
		});
	});
	</script>
</head>
<body id="jive-body">
<div id="main">
	<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tbody>
		<tr valign="top">
			<td width="99%" id="jive-content">
 				<h1>编辑服务</h1>
				<div id="jive-main-content">

<form action="#" id="f" method="post">
	<div class="jive-contentBox" style="-moz-border-radius: 3px;">
		<table cellpadding="3" cellspacing="1" border="0" width="600">
		<tr><td colspan=3 class="text" style="padding-bottom: 10px;">
			<p>请使用下面的表单修改服务信息</p>
		</td></tr>
		<tr>
			<td class="jive-label">
				服务名称:
			</td>
			<td>
				<input type="text" id="serviceName" value="<c:out value='${service.name}'/>" size="40" maxlength="255" <c:if test="${service != null}">disabled</c:if>/>
			</td>
		</tr>
		<tr valign="top">
			<td class="jive-label">
				描述:
			</td>
			<td>
				<textarea id="description" cols="55" rows="5" wrap="virtual"><c:out value="${service.description}"/></textarea>
			</td>
		</tr>
		<tr valign="top">
			<td class="jive-label">
				服务过程:
			</td>
			<td>
				<textarea id="xml" cols="55" rows="12" wrap="virtual"><c:out value="${service.xml}"/></textarea>
			</td>
		</tr>
		</table>
	</div>
<input type="button" id="save" value="保存服务">
<input type="button" id="cancel" value="取消">
</form>

				</div>
			</td>
		</tr>
	</tbody>
	</table>
</div>
</body>
</html>
